#include <stdio.h>
// 练习2:修改昨天的练习4 加盟费 那道题，当程序输入-1的时候，使用goto语句直接退出程序。
int main()
{
    float n;
    float rate;
    while (1)
    {
        printf("请输入营业额(万元):");
        int ret = scanf("%f", &n);
        if (ret != 1)
        {
            printf("数据异常！\n");
            while (getchar() != '\n')
                ;
            // return 0;
            continue;
        }

        if (n < 0 && n != -1)
        {
            printf("就这还能不赚钱？\n");
        }
        else if (n == -1)
        {
            printf("退出程序！");
            goto exit;
        }
        else
        {
            switch (n >= 100 ? 6 : n >= 60 ? 5
                               : n >= 40   ? 4
                               : n >= 20   ? 3
                               : n >= 10   ? 2
                                           : 1)
            {
            case 1:
                rate = 0.1;
                break;
            case 2:
                rate = 0.075;
                break;
            case 3:
                rate = 0.05;
                break;
            case 4:
                rate = 0.03;
                break;
            case 5:
                rate = 0.015;
                break;
            case 6:
                rate = 0.01;
                break;
            default:
                break;
            }
            printf("加盟费：%.3f*10000*%.3f=%.3f元\n", n, rate, n * rate * 10000);
        }
    }
exit:
    return 0;
}